<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('date_for_site'))
{
	function date_for_site($date)
	{
		$t = explode(" ", $date);
		
		$d = explode("-", $t[0]);
		return $d[2] . "/" . $d[1] . "/" . $d[0];
	}
}

if ( ! function_exists('natural_date_for_site'))
{
	function natural_date_for_site($date, $short_version = false)
	{
		$t = explode(" ", $date);
		
		$d = explode("-", $t[0]);
		
		if ($short_version)
		{
			return date('D, j F Y', mktime(0, 0, 0, $d[1], $d[2], $d[0]));
		} else
		{
			return date('l, jS F Y', mktime(0, 0, 0, $d[1], $d[2], $d[0]));
		}
		
		
		//return $d[2] . "/" . $d[1] . "/" . $d[0];
	}
}

if ( ! function_exists('date_for_db'))
{
	function date_for_db($date)
	{
		$d = explode('/', $date);
		
		return $d[2] . '-' . $d[1] . '-' . $d[0];
	}
}

if ( ! function_exists('extract_day_from_db'))
{
	function extract_day_from_db($date)
	{
		$t = explode(" ", $date);
		
		$d = explode("-", $t[0]);
		
		return $d[2];
	}
}

?>